package cn.shengchao.examstar.pay.model.service.fy.request;

import cn.shengchao.examstar.pay.model.service.fy.FYrequest;
import cn.shengchao.examstar.pay.model.service.fy.ParamName;
import cn.shengchao.examstar.pay.model.service.fy.RandomNumberGenerator;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

public class FuYouPreCreateRequest extends BaseFuYouRequest {

    @ParamName("version")
    private String version = "1.0";
    @ParamName("ins_cd")
    private String insCd;
    @ParamName("mchnt_cd")
    private String mchntCd;
    @ParamName("term_id")
    private String termId = "88888888";
    @ParamName("random_str")
    private String randomStr;
    @ParamName("goods_des")
    private String goodsDes;
    @ParamName("goods_detail")
    private String goodsDetail = "";
    @ParamName("goods_tag")
    private String goodsTag = "";
    @ParamName("product_id")
    private String productId = "";
    @ParamName("addn_inf")
    private String addnInf = "";
    @ParamName("mchnt_order_no")
    private String mchntOrderNo;
    @ParamName("curr_type")
    private String currType = "";
    @ParamName("order_amt")
    private String orderAmt;
    @ParamName("term_ip")
    private String termIp = "127.0.0.1";
    @ParamName("txn_begin_ts")
    private String txnBeginTs;
    @ParamName("notify_url")
    private String notifyUrl;
    @ParamName("limit_pay")
    private String limitPay = "";
    @ParamName("trade_type")
    private String tradeType;
    @ParamName("openid")
    private String openid = "";
    @ParamName("sub_openid")
    private String subOpenid;
    @ParamName("sub_appid")
    private String subAppid;
    @ParamName("reserved_fy_term_id")
    private String reservedFyTermId = "";
    @ParamName("reserved_expire_minute")
    private String reservedExpireMinute = "0";
    @ParamName("reserved_user_creid")
    private String reservedUserCreid = "";
    @ParamName("reserved_user_truename")
    private String reservedUserTruename = "";
    @ParamName("reserved_user_mobile")
    private String reservedUserMobile = "";

    public FuYouPreCreateRequest() {}

    public FuYouPreCreateRequest(FYrequest fYrequestData) {
        this.insCd = fYrequestData.getInsCd();
        this.mchntCd = fYrequestData.getMchntCd();
        this.randomStr = RandomNumberGenerator.generateNumber();
        this.goodsDes = fYrequestData.getGoodsDes();
        this.mchntOrderNo = fYrequestData.getOrderNo();
        this.orderAmt = fYrequestData.getPrice();
        SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault());
        this.txnBeginTs = sdf_ts.format(Calendar.getInstance().getTime());
        this.notifyUrl = fYrequestData.getNotifyUrl();
        this.tradeType = fYrequestData.getType();
        this.subOpenid = fYrequestData.getOpenid();
        this.subAppid = fYrequestData.getAppid();
    }

    // Getters and Setters
    public String getVersion() { return version; }
    public void setVersion(String version) { this.version = version; }
    public String getInsCd() { return insCd; }
    public void setInsCd(String insCd) { this.insCd = insCd; }
    public String getMchntCd() { return mchntCd; }
    public void setMchntCd(String mchntCd) { this.mchntCd = mchntCd; }
    public String getTermId() { return termId; }
    public void setTermId(String termId) { this.termId = termId; }
    public String getRandomStr() { return randomStr; }
    public void setRandomStr(String randomStr) { this.randomStr = randomStr; }
    public String getGoodsDes() { return goodsDes; }
    public void setGoodsDes(String goodsDes) { this.goodsDes = goodsDes; }
    public String getGoodsDetail() { return goodsDetail; }
    public void setGoodsDetail(String goodsDetail) { this.goodsDetail = goodsDetail; }
    public String getGoodsTag() { return goodsTag; }
    public void setGoodsTag(String goodsTag) { this.goodsTag = goodsTag; }
    public String getProductId() { return productId; }
    public void setProductId(String productId) { this.productId = productId; }
    public String getAddnInf() { return addnInf; }
    public void setAddnInf(String addnInf) { this.addnInf = addnInf; }
    public String getMchntOrderNo() { return mchntOrderNo; }
    public void setMchntOrderNo(String mchntOrderNo) { this.mchntOrderNo = mchntOrderNo; }
    public String getCurrType() { return currType; }
    public void setCurrType(String currType) { this.currType = currType; }
    public String getOrderAmt() { return orderAmt; }
    public void setOrderAmt(String orderAmt) { this.orderAmt = orderAmt; }
    public String getTermIp() { return termIp; }
    public void setTermIp(String termIp) { this.termIp = termIp; }
    public String getTxnBeginTs() { return txnBeginTs; }
    public void setTxnBeginTs(String txnBeginTs) { this.txnBeginTs = txnBeginTs; }
    public String getNotifyUrl() { return notifyUrl; }
    public void setNotifyUrl(String notifyUrl) { this.notifyUrl = notifyUrl; }
    public String getLimitPay() { return limitPay; }
    public void setLimitPay(String limitPay) { this.limitPay = limitPay; }
    public String getTradeType() { return tradeType; }
    public void setTradeType(String tradeType) { this.tradeType = tradeType; }
    public String getOpenid() { return openid; }
    public void setOpenid(String openid) { this.openid = openid; }
    public String getSubOpenid() { return subOpenid; }
    public void setSubOpenid(String subOpenid) { this.subOpenid = subOpenid; }
    public String getSubAppid() { return subAppid; }
    public void setSubAppid(String subAppid) { this.subAppid = subAppid; }
    public String getReservedFyTermId() { return reservedFyTermId; }
    public void setReservedFyTermId(String reservedFyTermId) { this.reservedFyTermId = reservedFyTermId; }
    public String getReservedExpireMinute() { return reservedExpireMinute; }
    public void setReservedExpireMinute(String reservedExpireMinute) { this.reservedExpireMinute = reservedExpireMinute; }
    public String getReservedUserCreid() { return reservedUserCreid; }
    public void setReservedUserCreid(String reservedUserCreid) { this.reservedUserCreid = reservedUserCreid; }
    public String getReservedUserTruename() { return reservedUserTruename; }
    public void setReservedUserTruename(String reservedUserTruename) { this.reservedUserTruename = reservedUserTruename; }
    public String getReservedUserMobile() { return reservedUserMobile; }
    public void setReservedUserMobile(String reservedUserMobile) { this.reservedUserMobile = reservedUserMobile; }
}
